# encoding: UTF-8
class Mark
  attr_accessor :teacher, :discipline, :date, :evaluation
  
  def initialize(teacher, date, discipline, evaluation)
    if date - Date.new(2009,9,1) < 0 or date - DateTime.now > 0
      raise ArgumentError, "Pažymio data turi būti ne ateityje ir ne senesnė nei 2009-09-01"
    end
    if not evaluation.is_a? Integer or evaluation < 1 or evaluation > 10 
      raise ArgumentError, "Pažymio įvertinimas turi būti sveikasis skaičius nuo 1 iki 10"
    end
    @teacher = teacher
    @discipline = discipline
    @date = date
    @evaluation = evaluation
  end
  
  def list_string
    @discipline + " (" + teacher.list_string + ") " + @date.to_s + " " + @evaluation.to_s
  end
end